package com.starblink.store.recommend.adapter

import android.content.Context
import android.util.AttributeSet
import androidx.constraintlayout.widget.ConstraintLayout
import com.starblink.android.basic.ext.inflater
import com.starblink.android.basic.ext.visibleOrGone
import com.starblink.basic.ext.load
import com.starblink.rocketreserver.fragment.MerchantWebVOF
import com.starblink.store.databinding.ItemFavouriteStoreBinding

class StoreHeadView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleRes: Int = 0
) : ConstraintLayout(context, attrs, defStyleRes) {
    lateinit var merchat: MerchantWebVOF

    val binding: ItemFavouriteStoreBinding = ItemFavouriteStoreBinding.inflate(inflater, this, true)

    companion object {
    }


    fun bindPost(merchat: MerchantWebVOF, position: Int) {
        this.merchat = merchat
        binding.title.text = merchat.merchantName
        binding.ivStore.load(merchat.logo ?: "",merchat.merchantName)
        merchat.cornerLabels?.let {
            binding.ivSale.visibleOrGone(it.isNotEmpty() && it.first().type == 1) {
            }
        }
    }
}